package com.juren.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.juren.service.IHelloService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * Hello服务API
 * </p>
 *
 * @description: 测试Hello服务API
 * @author: zhangtao
 * @date: Created in 2018-12-30 17:22
 * @version: V1.0
 * @modified:
 */
@RestController
@Slf4j
public class HelloController {

    @Reference(version = "${demo.service.version}")
    private IHelloService helloService;

    @GetMapping("/sayHello")
    public String sayHello(@RequestParam(defaultValue = "juren") String name) {
        System.out.println("服务消费===========");
        log.info("i'm ready to call someone......");
        String s = helloService.sayHello(name);
        System.out.println("服务被消费*****************");
        System.out.println("s=========="+s);
        return s;

    }
}
